<template>
	<view class="content">
		<!-- <view class="search-block">
			<view class="input-block">
				<input placeholder="请输入项目名称" v-model="name" @confirm="search" />
				<view class="iconfont icon-sousuo" @click="getList"></view>
			</view>
		</view> -->
		<template v-if="infoList.length>0">
			<view class="info-block" v-for="(item,index) in infoList" :key="item.id">
				<view class="project">{{index+1}}、{{item.matterName}}</view>
				<view style="display: flex;flex-direction: row;justify-content: space-between;">
					<view class="time">{{item.dutiesModel.duties}}：{{item.dutiesModel.name}}</view>
				</view>
				<view class="time">开始时间：{{item.startTime}}</view>
				<view class="time">责任书记：<text v-if="item.dutyNameText">{{item.dutyNameText}}</text><text
						v-else>暂无</text></view>
				<view class="time">责任单位：{{item.unit}}</view>
				<view @click="infoList[index].more =!item.more" class="time">进展情况:<text class="more"
						v-if="item.progress.length>0">{{item1.more?'【收起】':'【展开】'}}</text><text class="more" v-else
						style="margin-left: 10rpx;">暂无</text></view>
				<view v-for="(item1,index1) in item.progress" :key="item1.id" class="one" :class="item.more?'':'fewer'">
					<view class="onedot"></view>
					<view class="oneline"></view>
					<view class="onemain">
						<view class="onemaintitle">{{item1.time}}</view>
						<view class="onemaincon">{{item1.content}}</view>
					</view>
				</view>
			</view>
		</template>
		<view v-else style="text-align: center;">暂无数据</view>
	</view>
</template>

<script>
	import {
		getSecListApi
	} from '@/api/supervise.js'
	export default {
		data() {
			return {
				infoList: [],
				name: '',
				id: null,
				startTime: '',
				endTime: ''
			}
		},
		methods: {
			search() {
				this.getList()
			},
			getList() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				getSecListApi({
					id: this.id,
					startTime: this.startTime == '开始日期' ? '' : this.startTime,
					endTime: this.endTime == '结束日期' ? '' : this.endTime,
				}).then(res => {
					uni.hideLoading()
					let list = res.list || [];
					list.forEach((item, index) => {
						item.more = false;
					})
					this.infoList = list
				}).catch(() => {
					uni.hideLoading()
				})
			}
		},
		onLoad(e) {
			this.id = e.id
			this.startTime = e.startTime
			this.endTime = e.endTime
			this.getList()
		}
	}
</script>

<style lang="scss">
	.content {
		background: #f5f5f5;
		padding: 30rpx;
		min-height: 100vh;

		.search-block {
			position: relative;
			width: 100%;
			height: 60rpx;
			//padding: 0 30rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
			margin-bottom: 30rpx;

			.input-block {
				width: 100%;
				display: flex;
				flex-direction: row;
				align-items: center;
				border: 1px solid #808080;
				border-radius: 40rpx;
				padding: 0 10rpx;
				height: 60rpx;

				.iconfont {
					flex-grow: 0;
					color: #808080;
					margin: 0 10rpx;
				}

				input {
					flex-grow: 1;
					font-size: 28rpx;
					color: #808080;
					margin: 0 10rpx;
				}
			}
		}

		.info-block {
			min-height: 140rpx;
			padding: 30rpx;
			background: #fff;
			border-radius: 20rpx;
			box-shadow: 0 0 10px 0 #dedede;
			margin-bottom: 30rpx;
			height: auto;
			display: flex;
			flex-direction: column;
			justify-content: center;


			.leader {
				//width: calc(100% - 130rpx);
				font-size: 30rpx;
				font-weight: bold;
				margin-bottom: 30rpx;
				margin-top: 10rpx;
			}

			.project {
				font-size: 32rpx;
				font-weight: bold;
				margin-bottom: 30rpx;
				margin-top: 10rpx;
			}

			.time {
				font-size: 30rpx;
				margin-bottom: 30rpx;

				.more {
					color: $uni-color-primary;
					font-size: 30rpx;
				}
			}

			.one.fewer {
				display: -webkit-box;
				-webkit-box-orient: vertical;
				-webkit-line-clamp: 1;
				overflow: hidden;
				display: none;
			}

			.one {
				position: relative;
				padding-bottom: 10rpx;

				.onedot {
					left: -2rpx;
					width: 24rpx;
					height: 24rpx;
					position: absolute;
					//background-color: #4C7FE2;
					border: 1px solid #4C7FE2;
					border-radius: 50%;
					display: flex;
					justify-content: center;
					align-items: center;
					z-index: 1;
				}

				.oneline {
					position: absolute;
					left: 10rpx;
					height: calc(100% - 24rpx);
					border-left: 1px solid #1254F1;
					margin-top: 24rpx;
				}

				.onemain {
					position: relative;
					padding-left: 56rpx;
					top: -6rpx;
				}

				.onemaintitle {
					margin-bottom: 16rpx;
					padding-top: 8rpx;
					line-height: 1;
					font-size: 28rpx;
					color: #303133;
				}

				.onemaincon {
					color: #303133;
					background-color: #DFE8F9;
					padding: 20rpx;
					font-size: 28rpx;
					line-height: 60rpx;
				}
			}
		}
	}
</style>